package gorm

import (
	"github.com/glebarez/sqlite"
	// go-sqlite3是基于cgo，编译时有问题，
	//"gorm.io/driver/sqlite"
	"gorm.io/gorm"
	"server/chat_room_server/internal/config"
)

func NewSqlLiteDB(c config.Config) (db *gorm.DB, err error) {
	db, err = gorm.Open(sqlite.Open(c.DB.SQLLite.Dsn), &gorm.Config{})
	if err != nil {
		panic("failed to connect database")
	}
	initDB(db)
	return db, nil
}
